home *** CD-ROM | disk | FTP | other *** search
/ Champak 33 / Volume 33 - JOGO DISK .iso / Games / snowboard.swf / scripts / frame_7 / PlaceObject2_243_514 / CLIPACTIONRECORD onClipEvent(enterFrame).as next >
Text File  |  2007-01-15  |  6KB  |  228 lines

  1. onClipEvent(enterFrame){
  2.    if(_currentframe != 8)
  3.    {
  4.       if(yspeed == (- _root.air.bar._xscale) / 4)
  5.       {
  6.          falling = true;
  7.       }
  8.       _Y = _Y + yspeed;
  9.       yspeed += grav;
  10.       _X = _X + xspeed;
  11.       xspeed *= 0.91;
  12.       xspeed += 0.8;
  13.       cx += (_X - cx) / 5;
  14.       _root._x = Stage.width / 2 - cx;
  15.       cy += (_Y - cy + 25) / 5;
  16.       _root._y = Stage.height / 2 - cy;
  17.       _root.hud._x = cx;
  18.       _root.hud._y = cy - 30;
  19.       _root.wide._x = cx;
  20.       _root.wide._y = cy;
  21.       _root.light._x = cx;
  22.       _root.light._y = cy;
  23.       _root.bg._x = cx - 268;
  24.       _root.bg._y = cy - 150;
  25.       _root.air._x = cx + 275;
  26.       _root.air._y = cy - 125;
  27.       _root.hud._x = cx;
  28.       _root.hud._y = cy;
  29.       if(_root.land.hitTest(_X,_Y + h,true))
  30.       {
  31.          yspeed = 0;
  32.          grounded = true;
  33.          falling = false;
  34.          doubleJump = false;
  35.          if(_currentframe == 2)
  36.          {
  37.             gotoAndStop(3);
  38.          }
  39.          if(_currentframe == 7)
  40.          {
  41.             gotoAndStop(3);
  42.          }
  43.          if(_currentframe == 6)
  44.          {
  45.             gotoAndStop(3);
  46.          }
  47.          if(_currentframe == 4)
  48.          {
  49.             gotoAndStop(3);
  50.          }
  51.          if(_currentframe != 3 && _currentframe != 5)
  52.          {
  53.             gotoAndStop(1);
  54.          }
  55.          while(_root.land.hitTest(_X,_Y + h,true))
  56.          {
  57.             _Y = _Y - 0.1;
  58.          }
  59.       }
  60.       if(_root.land2.hitTest(_X,_Y - h + 10,true))
  61.       {
  62.          yspeed = 4;
  63.          while(_root.land2.hitTest(_X,_Y - h + 10,true))
  64.          {
  65.             _Y = _Y + 0.1;
  66.          }
  67.       }
  68.       if(Key.isDown(39))
  69.       {
  70.          _X = _X + 3;
  71.       }
  72.       if(Key.isDown(37))
  73.       {
  74.          _X = _X - 3;
  75.       }
  76.       if(Key.isDown(32) && grounded && !holding && _currentframe != 5)
  77.       {
  78.          holding = true;
  79.          gotoAndStop(5);
  80.       }
  81.       if(Key.isDown(32) && holding == true)
  82.       {
  83.          _root.air.bar._xscale += 5;
  84.       }
  85.       if(!Key.isDown(32) && holding)
  86.       {
  87.          yspeed = (- _root.air.bar._xscale) / 4;
  88.          gotoAndStop(2);
  89.          grounded = false;
  90.          holding = false;
  91.       }
  92.       if(Key.isDown(32) && !grounded && doubleJump != true && !falling)
  93.       {
  94.          yspeed = -13;
  95.          gotoAndStop(1);
  96.          gotoAndStop(2);
  97.          doubleJump = true;
  98.       }
  99.       if(yspeed <= -15)
  100.       {
  101.          yspeed = -15;
  102.       }
  103.       var nmbr = 0;
  104.       xval = 0;
  105.       yval = 0;
  106.       i = 1;
  107.       while(i < seg)
  108.       {
  109.          var tx = _X + r * Math.sin(i * (360 / seg) * 0.017453292519943295);
  110.          var ty = _Y - r * Math.cos(i * (360 / seg) * 0.017453292519943295);
  111.          if(_root.land.hitTest(tx,ty,true))
  112.          {
  113.             nmbr++;
  114.             xval += tx;
  115.             yval += ty;
  116.          }
  117.          i++;
  118.       }
  119.       if(nmbr > 0 && _xscale > 0)
  120.       {
  121.          _rotation = Math.atan2(_X - xval / nmbr,_Y - yval / nmbr) / 0.017453292519943295 * -1 - 180;
  122.       }
  123.       if(fall == true)
  124.       {
  125.          _Y = dy;
  126.          _X = dx;
  127.          fall = false;
  128.       }
  129.       if(fall)
  130.       {
  131.          _root.blink.play();
  132.       }
  133.       if(Key.isDown(65) && !grounded && this.tailgrab._currentframe >= 7 && this.tailgrab._currentframe <= 11 && _currentframe != 6 && _currentframe != 7)
  134.       {
  135.          this.gotoAndStop(4);
  136.          holdA = true;
  137.          _root.score += 10;
  138.       }
  139.       if(Key.isDown(65) && _currentframe == 6)
  140.       {
  141.          if(this.spin._currentframe >= 20)
  142.          {
  143.             this.gotoAndStop(4);
  144.          }
  145.          holdA = true;
  146.          _root.score += 10;
  147.       }
  148.       if(Key.isDown(65) && _currentframe == 7)
  149.       {
  150.          if(this.indie._currentframe >= 16)
  151.          {
  152.             this.gotoAndStop(4);
  153.          }
  154.          holdA = true;
  155.          _root.score += 10;
  156.       }
  157.       if(Key.isDown(83) && !grounded && _currentframe != 4 && _currentframe != 7)
  158.       {
  159.          this.gotoAndStop(6);
  160.          Shold = true;
  161.          _root.score += 10;
  162.       }
  163.       if(Key.isDown(83) && _currentframe == 4)
  164.       {
  165.          if(this.tailgrab._currentframe >= 7)
  166.          {
  167.             this.gotoAndStop(6);
  168.          }
  169.          Shold = true;
  170.          _root.score += 10;
  171.       }
  172.       if(Key.isDown(83) && _currentframe == 7)
  173.       {
  174.          if(this.indie._currentframe >= 16)
  175.          {
  176.             this.gotoAndStop(6);
  177.          }
  178.          Shold = true;
  179.          _root.score += 10;
  180.       }
  181.       if(Key.isDown(68) && !grounded && _currentframe != 4 && _currentframe != 6)
  182.       {
  183.          this.gotoAndStop(7);
  184.          Dhold = true;
  185.          _root.score += 10;
  186.       }
  187.       if(Key.isDown(68) && _currentframe == 6)
  188.       {
  189.          if(this.spin._currentframe >= 20)
  190.          {
  191.             this.gotoAndStop(7);
  192.          }
  193.          Dhold = true;
  194.          _root.score += 10;
  195.       }
  196.       if(Key.isDown(68) && _currentframe == 4)
  197.       {
  198.          if(this.tailgrab._currentframe >= 7)
  199.          {
  200.             this.gotoAndStop(7);
  201.          }
  202.          Dhold = true;
  203.          _root.score += 10;
  204.       }
  205.       if(!grounded)
  206.       {
  207.          if(!Key.isDown(65))
  208.          {
  209.             holdA = false;
  210.          }
  211.          if(!Key.isDown(83))
  212.          {
  213.             Shold = false;
  214.          }
  215.          if(!Key.isDown(68))
  216.          {
  217.             Dhold = false;
  218.          }
  219.       }
  220.    }
  221.    if(_root.hud.lives <= 0)
  222.    {
  223.       this.gotoAndStop(8);
  224.    }
  225.    _root.fadeIn._x = cx;
  226.    _root.fadeIn._y = cy;
  227. }
  228.